//
//  WBComposeButton.swift
//  weibo
//
//  Created by yanghong on 15/12/16.
//  Copyright © 2015年 杨鸿. All rights reserved.
//

import UIKit

class WBComposeButton: UIButton {

    //取消按钮的高亮效果
    
    override var highlighted: Bool {
    
    set{


      }
    get{
        
        return false
        
      }
 
     }
    
  override  init(frame: CGRect) {
    super.init(frame: frame)
    
    titleLabel?.font = UIFont.systemFontOfSize(14)
    
    setTitleColor(UIColor.darkGrayColor(), forState: .Normal)
    
    imageView?.contentMode = .Center
    
    titleLabel?.textAlignment = .Center
    
    }

     required init?(coder aDecoder: NSCoder) {
      fatalError("init(coder:) has not been implemented")
    }
    
    override func layoutSubviews() {
        //一定要记得写上 super.layoutSubviews()  一定!!!
        super.layoutSubviews()
        // 调整imageview
        imageView?.y = 0
        imageView?.width = width
        imageView?.height = width
        //调整titleLabel 
        
        titleLabel?.x = 0
        
        titleLabel?.y = width
        
        titleLabel?.width = width
        
        titleLabel?.height = height - width
    }
 
}
